import { PartialType } from '@nestjs/mapped-types';
import { Role } from '../entities/role.entity';
import {
  IsArray,
  IsBoolean,
  IsNotEmpty,
  IsOptional,
  IsString,
  IsUUID,
  Length,
} from 'class-validator';

export class SaveRoleDto extends PartialType(Role) {
  @IsNotEmpty()
  @IsArray()
  menuIds: string[];

  @IsNotEmpty()
  @IsArray()
  permissionIds: string[];

  @IsNotEmpty()
  @IsString()
  @Length(2, 20)
  name: string;

  @IsOptional()
  @Length(0, 256)
  remark?: string;

  @IsOptional()
  @IsBoolean()
  state?: boolean;

  @IsOptional()
  @IsUUID()
  id?: string;
}
